home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SPACE 1
/
SPACE - Library 1 - Volume 1.iso
/
utilitys
/
410
/
mapper.gfa
(
.txt
)
< prev
next >
Wrap
GFA-BASIC Atari
|
1985-11-19
|
50KB
|
2,059 lines
'
' DUNGEON MAPPER
' Version 1.0
'
' In the public domain by Jeff Casbeer : GEnie J.CASBEER : CIS 76214,450
'
' Unfold the general_comments procedure for program documentation.
' User documentation is in a separate file, MAPPER.DOC.
' Program requires files MAPPER.RSC and DMICONS.DAT in the same directory.
'
' **** QUICK START ****
' 1) Run the program.
' 2) Press "Load" on the opening dialog.
' 3) Load SAMPLE.MAP and SAMPLE.LEG.
' 4) Right click your mouse when the load is complete.
'
GOSUB main_loop
END
> PROCEDURE general_comments !Look here if you're hacking...
'
' ***** IMPORTANT VARIABLES:
'
' There are many variables, but (I hope) the significant ones are clearly
' labelled in the <init> routine. Here's a little more detail on the
' really big ones.
'
' icon$ is the screen full of icons. They're loaded in as an SPUT sprite.
'
' cursor$ and cursor& cursor$ is the 10X10 grid selected as the current
' icon to be placed on the map with a left click.
' This is just an SGET of that 10X10 grid from the
' icon screen.
' Cursor& is the NUMBER of the 10X10 grid selected
' as the cursor$, as counted from left to right and
' down the "page" of icons. i.e., the 10X10 grid
' in the upper-left corner of the icon page is
' cursor& number 0, the one next to it (right) is
' number 1, etc. When the icon is placed on the
' map the number is placed in the map&() array.
' See <icon_main_loop> to see how this works.
'
' map&() is a two dimensional array used to hold the icon number (cursor%)
' in each "cell" (x,y) on the map. This array is used whenever a
' screen redraw is needed (usually by <redraw_from_array>).
'
' legend&() holds an icon number (cursor&) for each icon defined in the
' legend.
'
' legend$() holds the legend text for each icon. (legend$(icon_number,
' text_line_number)).
'
' ***** PROGRAM FLOW:
'
' The program initializes through <init>, then offers the icons to the user
' first <icon_main_loop>.
'
' The program bounces between mouse and keyboard checks in the
' <main_loop>. If the right button is pressed the program alternates
' between the <icon_main_loop> and the <map_main_loop>. These two procedures
' offer the user the icon set and the map, respectively.
'
' Any keypress calls <get_key>. This routine will produce the main menu
' <dialog_box>, unless the keypress is an arrow key.
'
' If the key is an arrow key, the map scrolls 10 "blocks" (10X10 grids)
' in the direction of the arrow, using the routines <scroll_east, _west,
' _north, and _south>. These four procedures check for map edge and call
' <redraw_from_array> to complete the map redraw.
'
' If the key isn't an arrow and the main menu dialog is called, <get_key>
' calls the service routine for the menu option as appropriate:
'
' FILE SECTION:
'
' 1) Save the map calls <save_map>.
' 2) Load the map calls <load_map>.
' 3) Save the legend calls <save_legend>.
' 4) Load the legend calls <load_legend>.
' 5) Quit calls <quit>.
'
' EDIT SECTION:
' 6) Fill calls <fill_area>. Fill area completes the logical fill using
' <select_map_loc> to select the location to begin the fill and
' uses <redraw_from_array> to redraw the screen.
' 7) Title calls <dialog_box3>. Updates variables title$ and subtitle$.
' 8) Rotate calls <rotate_map>. This simply saves the array and reloads
' 90 degrees offset.
' 9) Flip calls <flip_map>, which is another save/reload sequence.
' 10) Insert Row/Column completes the logical insert with <ins_column_row>
' and calls <redraw_from_array> to redraw the screen.
' 11) Delete Row/Column does the same as #6 for a delete using
' <del_column_row>.
' 12) Edit Icons calls, strangely enough, <edit_icons>.
'
' PRINT SECTION:
' 13) Printer config calls <config_printer>, which gets help from dialog
' box #6.
' 14) Tiled calls <print_tiled>.
' 15) Paged calls <print_paged>. These two routines handle all printed
' map and legend output, with the help of <print_screen>. <print_screen>
' calls <bottom_entry> and <top_entry>, which handle the exceptions of
' the bottoms and tops of pages for the legend printer, and <page_eject>
' for the obvious reason. I would suggest that the print routines will
' be the most difficult thing to change -- they were certainly the most
' time consuming to write!
' 16) Graph paper calls <print_graph_paper>. This routine uses dialog box
' #7.
'
' LEGEND SECTION:
' 17) Add/Edit Entry calls <legend_main_loop> which selects the icon to
' be added/edited, performs the logical check of the current legend
' entries to determine which (add or edit) is appropriate, and uses
' <dialog_box4> to interract with the user.
' 18) Delete Legend calls <delete_legend_entry> which selects and deletes
' if the icon is in the legend.
' 19) Browse Legend calls <browse_legend_entries> which uses <dialog_box5>
' to confuse the user.
'
' I think that's it. Hope this helps you chop this code up enough to meet
' your needs. If not, drop me a line at the addresses in the author box.
' It's usually easier (faster) to reach me on GEnie, but I get on to
' Compuserve once or twice a month, too.
'
RETURN
> PROCEDURE init !Set up resources,arrays,etc.,etc.
' **************** TEST RESOLUTION (NEEDS LOW)
CLS
IF XBIOS(4)<>0
ALERT 1," | I Need Low Resolution... | (TRUST me, it's WORTH it!) ",1," Hmmm... ",a&
END
ENDIF
' **************** CONFIG PRINTER
dialog1%=4
dialog2%=XBIOS(33,dialog1%)
print_to_screen&=FALSE
' **************** RESOURCES
RESERVE FRE(0)-33000
x&=RSRC_LOAD("\mapper.rsc")
IF x&=0
ALERT 1," | | Resource MAPPER.RSC Not Found ",1," Abort ",a&
GOSUB quit
END
ENDIF
~RSRC_GADDR(0,0,dialog1%)
~RSRC_GADDR(0,1,dialog2%)
~RSRC_GADDR(0,2,dialog3%)
~RSRC_GADDR(0,3,dialog4%)
~RSRC_GADDR(0,4,dialog5%)
~RSRC_GADDR(0,5,dialog6%)
~RSRC_GADDR(0,6,dialog7%)
~RSRC_GADDR(0,7,dialog8%)
~FORM_CENTER(dialog1%,x1%,y1%,w1%,h1%)
~FORM_CENTER(dialog2%,x2%,y2%,w2%,h2%)
~FORM_CENTER(dialog3%,x3%,y3%,w3%,h3%)
title$="Untitled"
subtitle$="Untitled"
CHAR{{OB_SPEC(dialog3%,5)}}=title$
CHAR{{OB_SPEC(dialog3%,8)}}=subtitle$
~FORM_CENTER(dialog4%,x4%,y4%,w4%,h4%)
~FORM_CENTER(dialog5%,x5%,y5%,w5%,h5%)
~FORM_CENTER(dialog6%,x6%,y6%,w6%,h6%)
~FORM_CENTER(dialog7%,x7%,y7%,w7%,h7%)
~OBJC_CHANGE(dialog7%,13,0,x7%,y7%,w7%,h7%,1,0)
~FORM_CENTER(dialog8%,x8%,y8%,w8%,h8%)
' **************** ICONS
IF NOT EXIST("DMICONS.DAT")
ALERT 1," | | Icon File DMICONS.DAT | Not Found|",1," Abort ",a&
GOSUB quit
END
ENDIF
OPEN "I",#1,"DMICONS.DAT"
icons$=SPACE$(32000)
CLOSE #1
BLOAD "\DMICONS.DAT",VARPTR(icons$)
' **************** INITIALIZE DUAL SCREEN LOGIC
GOSUB allocate_screens
~XBIOS(5,L:screen%(2),L:screen%(1),-1)
CLS
SPUT icons$
~XBIOS(5,L:screen%(1),L:screen%(1),-1)
CLS
' **************** MISC INIT
SGET map$
cursor&=-1 !Start as nothing
GOSUB blank_cursor
cursor$=blank$
' **************** PRINT ROUTINE VARIABLES
DIM pr&(50,6) !6=lo-x,lo-y,,n,e,s,w
ARRAYFILL pr&(),-1
' **************** LOGICALS
legend_saved&=TRUE !"Legend not saved" flag
map_saved&=TRUE !Logical for "Map not saved" message
' **************** LET USER INPUT START ACTIVITY/SIZE
GOSUB dialog_box8
IF DIM?(map&())=0 !Didn't load an old map...
CLS
ON ERROR GOSUB recover_init_error !In case this won't fit in memory
' **************** LEGEND VARIABLES
l_current_max&=0 !Current # of legend entries
DIM legend$(lmax&,4) !Legend Text
DIM legend&(lmax&) !Legend Icons
DIM l&(lmax&) !Internal pointer array for legend&()
ARRAYFILL legend&(),-1
ARRAYFILL l&(),-1
' **************** SCREEN FLAGS
on_icon&=FALSE !Which screen is visible...
on_map&=FALSE
' **************** MAP VARIABLES
xbase&=0 !Base values for scrolling...
ybase&=0
DIM map&(xmax&,ymax&)
DIM m|(xmax&,ymax&) !An internal array supporting map&() operations
ARRAYFILL map&(),-1 !-1 means the map cell is untouched.
ON ERROR
ENDIF
RETURN
> PROCEDURE recover_init_error !Too big, try again...
ALERT 1," | Map/Legend Combination Won't | Fit In Memory. Try Again... | ",1," OK ",a&
GOSUB quit
RUN
RETURN
> PROCEDURE dialog_box !Give 'em a menu...
FOR loop&=0 TO 1
x&=FORM_DIAL(loop&,0,0,0,0,0,y1%,w1%,h1%)
NEXT loop&
~OBJC_DRAW(dialog1%,0,3,x1%,y1%,w1%,h1%)
a&=TRUE
WHILE a&=TRUE
a&=FALSE
obj%=FORM_DO(dialog1%,0)
IF obj%=33
GOSUB dialog_box2 !Author
~OBJC_CHANGE(dialog1%,obj%,0,x1%,y1%,w1%,h1%,0,0)
~OBJC_DRAW(dialog1%,0,10,x1%,y1%,w1%,h1%)
a&=TRUE
ENDIF
IF obj%=14 !Title
GOSUB dialog_box3
~OBJC_CHANGE(dialog1%,obj%,0,x1%,y1%,w1%,h1%,0,0)
~OBJC_DRAW(dialog1%,0,10,x1%,y1%,w1%,h1%)
a&=TRUE
ENDIF
IF obj%=25
GOSUB config_printer !Printer Configuration
~OBJC_CHANGE(dialog1%,obj%,0,x1%,y1%,w1%,h1%,0,0)
~OBJC_DRAW(dialog1%,0,10,x1%,y1%,w1%,h1%)
a&=TRUE
ENDIF
IF obj%=24
GOSUB print_graph_paper !Print Graph Paper
~OBJC_CHANGE(dialog1%,obj%,0,x1%,y1%,w1%,h1%,0,0)
~OBJC_DRAW(dialog1%,0,10,x1%,y1%,w1%,h1%)
a&=TRUE
ENDIF
WEND
FOR pause&=1 TO 2000
NEXT pause&
~OBJC_CHANGE(dialog1%,obj%,0,x1%,y1%,w1%,h1%,0,1)
FOR loop&=2 TO 3
x&=FORM_DIAL(loop&,0,0,0,0,x1%,y1%,w1%,h1%)
NEXT loop&
IF obj%=31 !Cancel
obj%=0
~OBJC_CHANGE(dialog1%,31,0,x1%,y1%,w1%,h1%,32,0)
ENDIF
RETURN
> PROCEDURE dialog_box2 !Heeeeeeere's Johnny! (author box)
FOR loop&=0 TO 1
~FORM_DIAL(loop&,-x2%,-y2%,0,0,x2%,y2%,w2%,h2%)
NEXT loop&
~OBJC_DRAW(dialog2%,0,10,x2%,y2%,w2%,h2%)
~FORM_DO(dialog2%,0)
FOR pause&=1 TO 2000
NEXT pause&
~OBJC_CHANGE(dialog2%,9,0,x2%,y2%,w2%,h2%,48,1)
FOR loop&=2 TO 3
~FORM_DIAL(loop&,0,0,0,0,x2%,y2%,w2%,h2%)
NEXT loop&
RETURN
> PROCEDURE dialog_box3 !To change the title...
FOR loop&=0 TO 1
~FORM_DIAL(loop&,0,0,0,0,x3%,y3%,w3%,h3%)
NEXT loop&
~OBJC_CHANGE(dialog3%,9,0,x3%,y3%,w3%,h3%,32,0)
~OBJC_DRAW(dialog3%,0,2,x3%,y3%,w3%,h3%)
obj3%=FORM_DO(dialog3%,0)
FOR loop&=2 TO 3
~FORM_DIAL(loop&,0,0,0,0,x3%,y3%,w3%,h3%)
NEXT loop&
title$=CHAR{{OB_SPEC(dialog3%,5)}}
subtitle$=CHAR{{OB_SPEC(dialog3%,8)}}
RETURN
> PROCEDURE dialog_box4 !Legend Editor
FOR loop&=0 TO 1
~FORM_DIAL(loop&,0,0,0,0,x4%,y4%,w4%,h4%)
NEXT loop&
~OBJC_CHANGE(dialog4%,8,0,x4%,y4%,w4%,h4%,32,0)
~OBJC_CHANGE(dialog4%,9,0,x4%,y4%,w4%,h4%,0,0)
~OBJC_DRAW(dialog4%,0,2,x4%,y4%,w4%,h4%)
obj4%=FORM_DO(dialog4%,0)
FOR loop&=2 TO 3
~FORM_DIAL(loop&,0,0,0,0,x4%,y4%,w4%,h4%)
NEXT loop&
RETURN
> PROCEDURE dialog_box8 !New Map
WHILE xmax&=0
CLS
FOR loop&=0 TO 1
~FORM_DIAL(loop&,0,0,0,0,x8%,y8%,w8%,h8%)
NEXT loop&
~OBJC_CHANGE(dialog8%,11,0,x8%,y8%,w8%,h8%,32,0)
~OBJC_CHANGE(dialog8%,12,0,x8%,y8%,w8%,h8%,0,0)
~OBJC_DRAW(dialog8%,0,2,x8%,y8%,w8%,h8%)
obj8%=FORM_DO(dialog8%,0)
IF obj8%=12
FOR loop&=2 TO 3
~FORM_DIAL(loop&,0,0,0,0,x8%,y8%,w8%,h8%)
NEXT loop&
map_saved&=TRUE
GOSUB load_map
legend_saved&=TRUE
GOSUB load_legend
ELSE
xmax&=VAL(CHAR{{OB_SPEC(dialog8%,4)}})
IF xmax&<31
xmax&=31
ENDIF
ymax&=xmax&
lmax&=VAL(CHAR{{OB_SPEC(dialog8%,8)}}) !Maximum # of legend entries
FOR loop&=2 TO 3
~FORM_DIAL(loop&,0,0,0,0,x8%,y8%,w8%,h8%)
NEXT loop&
ENDIF
WEND
RETURN
> PROCEDURE main_loop !Bounce between mouse and keyboard
GOSUB init
GOSUB icon_main_loop
forever&=TRUE
WHILE forever&
kbd$=INKEY$
MOUSE mx&,my&,mse&
IF mse&>0 AND NOT (mse&=1 AND on_map&)
WHILE MOUSEK>0
WEND
ENDIF
IF kbd$<>""
GOSUB get_key
ELSE IF mse&=2 AND on_icon&
GOSUB map_main_loop
ELSE IF mse&=2 AND on_map&
GOSUB icon_main_loop
ELSE IF mse&=1 AND on_map&
GOSUB map_main_loop
ELSE IF mse&=1 AND on_icon&
GOSUB icon_main_loop
ENDIF
WEND
RETURN
> PROCEDURE icon_main_loop !Go get another icon
IF NOT on_icon&
SGET map$
CLS
SPUT icons$
on_icon&=TRUE
on_map&=FALSE
ENDIF
IF mse&=1
x&=INT(mx&/10)*10 !This is the cursor% decode logic
y&=INT(my&/10)*10
GET x&,y&,x&+9,y&+9,cursor$ !Pick up the cursor$
PUT x&,y&,cursor$,10 !Invert it and put it back down.
FOR i&=1 TO 1000 !Pause a sec...
NEXT i&
PUT x&,y&,cursor$ !...And put it back down right.
IF cursor$<>blank$
cursor&=(x&/10)+(y&/10)*32 !Important variable!
ELSE
cursor&=-1
ENDIF
ENDIF
RETURN
> PROCEDURE map_main_loop !Draw on the map
IF NOT on_map&
CLS
SPUT map$
on_icon&=FALSE
on_map&=TRUE
ENDIF
IF mse&=1
x&=INT(mx&/10)*10
y&=INT(my&/10)*10
PUT x&,y&,cursor$
map&(INT(mx&/10)+xbase&,INT(my&/10)+ybase&)=cursor&
map_saved&=FALSE
ENDIF
RETURN
> PROCEDURE get_key !Keyboard central
IF LEN(kbd$)=1
IF on_map&
SGET map$
ENDIF
GOSUB dialog_box
IF on_icon&
CLS
SPUT icons$
ELSE
CLS
SPUT map$
ENDIF
IF obj%>0
SELECT obj%
CASE 4
GOSUB save_map
CASE 5
GOSUB load_map
CASE 6
a&=1
IF NOT legend_saved&
ALERT 2," | This LEGEND Is NOT Saved. | Quit Without Saving It? | ",2,"Yes|No",a&
ENDIF
IF map_saved&
IF a&=1
GOSUB quit
ENDIF
ELSE
IF a&=1
ALERT 2," | This MAP Is NOT Saved. | Quit Without Saving It? | ",2,"Yes|No",a&
IF a&=1
GOSUB quit
ENDIF
ENDIF
ENDIF
CASE 8
GOSUB load_legend
CASE 9
GOSUB save_legend
CASE 13
GOSUB fill_area
CASE 15
GOSUB ins_column_row
CASE 17
GOSUB del_column_row
CASE 18
GOSUB rotate_map
CASE 19
GOSUB flip_map
CASE 20
GOSUB edit_icons
CASE 21
GOSUB print_paged
CASE 22
GOSUB print_paged
CASE 23
GOSUB print_tiled
CASE 28
GOSUB legend_main_loop
CASE 29
GOSUB delete_legend_entry
CASE 30
GOSUB browse_legend_entries
ENDSELECT
ENDIF
ELSE
SELECT CVI(kbd$)
CASE 72
GOSUB scroll_north
CASE 80
GOSUB scroll_south
CASE 75
GOSUB scroll_west
CASE 77
GOSUB scroll_east
ENDSELECT
ENDIF
RETURN
> PROCEDURE legend_main_loop !Add/Edit legend entries.
IF l_current_max&<lmax&
WHILE MOUSEK>0
WEND
cursor2$=cursor$
cursor2&=cursor&
ALERT 2," | Select The Subject Icon. | Right Click When Done. ",1," OK | Cursor | Cancel ",a&
IF a&<3
IF a&=1
MOUSE mx&,my&,mse&
WHILE mse&<>2
MOUSE mx&,my&,mse&
GOSUB icon_main_loop
WEND
ENDIF
IF cursor$<>blank$
CLS
PRINT AT(5,2);"Legend entry for icon..."
PUT 23*10,8,cursor$
j&=-1
FOR i&=0 TO l_current_max&
IF legend&(i&)=cursor&
j&=i&
ENDIF
NEXT i&
IF j&>=0
CHAR{{OB_SPEC(dialog4%,3)}}=legend$(j&,0)
CHAR{{OB_SPEC(dialog4%,4)}}=legend$(j&,1)
CHAR{{OB_SPEC(dialog4%,5)}}=legend$(j&,2)
CHAR{{OB_SPEC(dialog4%,6)}}=legend$(j&,3)
CHAR{{OB_SPEC(dialog4%,7)}}=legend$(j&,4)
GOSUB dialog_box4
IF obj4%=8
legend$(j&,0)=CHAR{{OB_SPEC(dialog4%,3)}}
legend$(j&,1)=CHAR{{OB_SPEC(dialog4%,4)}}
legend$(j&,2)=CHAR{{OB_SPEC(dialog4%,5)}}
legend$(j&,3)=CHAR{{OB_SPEC(dialog4%,6)}}
legend$(j&,4)=CHAR{{OB_SPEC(dialog4%,7)}}
legend_saved&=FALSE
ENDIF
ELSE
CHAR{{OB_SPEC(dialog4%,3)}}=""
CHAR{{OB_SPEC(dialog4%,4)}}=""
CHAR{{OB_SPEC(dialog4%,5)}}=""
CHAR{{OB_SPEC(dialog4%,6)}}=""
CHAR{{OB_SPEC(dialog4%,7)}}=""
GOSUB dialog_box4
IF obj4%=8
legend$(l_current_max&,0)=CHAR{{OB_SPEC(dialog4%,3)}}
legend$(l_current_max&,1)=CHAR{{OB_SPEC(dialog4%,4)}}
legend$(l_current_max&,2)=CHAR{{OB_SPEC(dialog4%,5)}}
legend$(l_current_max&,3)=CHAR{{OB_SPEC(dialog4%,6)}}
legend$(l_current_max&,4)=CHAR{{OB_SPEC(dialog4%,7)}}
legend&(l_current_max&)=cursor&
legend_saved&=FALSE
INC l_current_max&
ENDIF
ENDIF
ELSE
ALERT 1," | Can't Legend A Blank Cursor | ",1," OK ",a&
ENDIF
ENDIF
cursor$=cursor2$
cursor&=cursor2&
CLS
GOSUB recover_screen
ELSE
ALERT 1," | Out Of Legend Space | ",1," OK ",a&
ENDIF
RETURN
> PROCEDURE delete_legend_entry !Don't need it? Lose it here.
ALERT 3," | Select The Subject Icon. | Right Click When Done. ",1," OK | Cancel ",a&
IF a&=1
MOUSE mx&,my&,mse&
WHILE mse&<>2
MOUSE mx&,my&,mse&
GOSUB icon_main_loop
WEND
j&=-1
FOR i&=0 TO l_current_max&
IF legend&(i&)=cursor&
j&=i&
ENDIF
NEXT i&
IF j&>=0
FOR i&=j& TO l_current_max&
legend&(i&)=legend&(i&+1)
legend$(i&,0)=legend$(i&+1,0)
legend$(i&,1)=legend$(i&+1,1)
legend$(i&,2)=legend$(i&+1,2)
legend$(i&,3)=legend$(i&+1,3)
legend$(i&,4)=legend$(i&+1,4)
NEXT i&
DEC l_current_max&
ALERT 1," | Icon Found And Deleted | From Legend | ",1," OK ",a&
IF l_current_max&=0
legend_saved&=TRUE
ENDIF
ELSE
ALERT 3," | Icon Not Found In Legend | ",1," OK ",a&
ENDIF
ENDIF
RETURN
> PROCEDURE browse_legend_entries !Includes dialog box #5.
IF l_current_max&>0
legend_saved&=FALSE
j&=0
FOR loop&=0 TO 1
~FORM_DIAL(loop&,0,0,0,0,x5%,y5%,w5%,h5%)
NEXT loop&
WHILE j&<l_current_max& AND l_current_max&>0
x&=legend&(j&)
cursory&=INT(x&/32)*10
cursorx&=MOD(x&,32)*10
CLS
SPUT icons$
GET cursorx&,cursory&,cursorx&+9,cursory&+9,cursor2$
CLS
PRINT AT(5,2);"Legend entry for icon..."
PUT 23*10,8,cursor2$
CHAR{{OB_SPEC(dialog5%,4)}}=legend$(j&,0)
CHAR{{OB_SPEC(dialog5%,5)}}=legend$(j&,1)
CHAR{{OB_SPEC(dialog5%,6)}}=legend$(j&,2)
CHAR{{OB_SPEC(dialog5%,7)}}=legend$(j&,3)
CHAR{{OB_SPEC(dialog5%,8)}}=legend$(j&,4)
~OBJC_CHANGE(dialog5%,9,0,x5%,y5%,w5%,h5%,32,0)
~OBJC_DRAW(dialog5%,0,2,x5%,y5%,w5%,h5%)
obj5%=FORM_DO(dialog5%,0)
~OBJC_CHANGE(dialog5%,obj5%,0,x5%,y5%,w5%,h5%,0,0)
SELECT obj5%
CASE 10 !Quit
j&=l_current_max&+1
CASE 9 !Next
legend$(j&,0)=CHAR{{OB_SPEC(dialog5%,4)}}
legend$(j&,1)=CHAR{{OB_SPEC(dialog5%,5)}}
legend$(j&,2)=CHAR{{OB_SPEC(dialog5%,6)}}
legend$(j&,3)=CHAR{{OB_SPEC(dialog5%,7)}}
legend$(j&,4)=CHAR{{OB_SPEC(dialog5%,8)}}
INC j&
IF j&=l_current_max&
ALERT 3," | End Of Legend | ",1," OK ",a&
ENDIF
CASE 11 !Previous
legend$(j&,0)=CHAR{{OB_SPEC(dialog5%,4)}}
legend$(j&,1)=CHAR{{OB_SPEC(dialog5%,5)}}
legend$(j&,2)=CHAR{{OB_SPEC(dialog5%,6)}}
legend$(j&,3)=CHAR{{OB_SPEC(dialog5%,7)}}
legend$(j&,4)=CHAR{{OB_SPEC(dialog5%,8)}}
DEC j&
CASE 3 !Delete
FOR i&=j& TO l_current_max&
legend&(i&)=legend&(i&+1)
legend$(i&,0)=legend$(i&+1,0)
legend$(i&,1)=legend$(i&+1,1)
legend$(i&,2)=legend$(i&+1,2)
legend$(i&,3)=legend$(i&+1,3)
legend$(i&,4)=legend$(i&+1,4)
NEXT i&
DEC l_current_max&
ALERT 1," | Icon Found And Deleted | From Legend | ",1," OK ",a&
IF l_current_max&=0
legend_saved&=TRUE
ALERT 3," | No More Legend Entries Exist | ",1," OK ",a&
ENDIF
IF j&>=l_current_max& AND l_current_max&>0
DEC j&
ENDIF
ENDSELECT
IF j&=-1
j&=0
ALERT 3," | Beginning Of Legend | ",1," OK ",a&
ENDIF
WEND
FOR loop&=2 TO 3
~FORM_DIAL(loop&,0,0,0,0,x5%,y5%,w5%,h5%)
NEXT loop&
GOSUB recover_screen
ELSE
ALERT 3," | No Legend Entries Exist | ",1," OK ",a&
ENDIF
RETURN
> PROCEDURE recover_screen !Reset from non-map/icon screen
IF on_icon&
CLS
SPUT icons$
ELSE
CLS
SPUT map$
ENDIF
SHOWM
RETURN
> PROCEDURE scroll_east !The...
IF on_map&
IF xbase&+41<xmax&
xbase&=xbase&+10
GOSUB redraw_from_array
ELSE IF xbase&+31=xmax&
ALERT 3," | End Of Map East... | ",1,"OK",a&
ELSE
xbase&=xmax&-31
GOSUB redraw_from_array
ENDIF
ENDIF
RETURN
> PROCEDURE scroll_west !Four...
IF on_map&
IF xbase&-10>=0
xbase&=xbase&-10
GOSUB redraw_from_array
ELSE IF xbase&=0
ALERT 3," | End Of Map West... | ",1,"OK",a&
ELSE
xbase&=0
GOSUB redraw_from_array
ENDIF
ENDIF
RETURN
> PROCEDURE scroll_north !Scroll...
IF on_map&
IF ybase&-10>=0
ybase&=ybase&-10
GOSUB redraw_from_array
ELSE IF ybase&=0
ALERT 3," | End Of Map North... | ",1,"OK",a&
ELSE
ybase&=0
GOSUB redraw_from_array
ENDIF
ENDIF
RETURN
> PROCEDURE scroll_south !Directions
IF on_map&
IF ybase&+29<ymax&
ybase&=ybase&+10
GOSUB redraw_from_array
ELSE IF ybase&+19=ymax&
ALERT 3," | End Of Map South... | ",1,"OK",a&
ELSE
ybase&=ymax&-19
GOSUB redraw_from_array
ENDIF
ENDIF
RETURN
> PROCEDURE redraw_from_array !Redraw after scroll, load, etc.
LOCAL x&,i&,j&,cursor$
x&=-1
CLS
FOR i&=xbase& TO xbase&+31
FOR j&=ybase& TO ybase&+19
IF map&(i&,j&)>=0
IF map&(i&,j&)<>x&
cursory&=INT(map&(i&,j&)/32)*10
cursorx&=MOD(map&(i&,j&),32)*10
~XBIOS(5,L:screen%(2),L:screen%(1),-1) !Peek at the icon screen
GET cursorx&,cursory&,cursorx&+9,cursory&+9,cursor$ !Get an icon
~XBIOS(5,L:screen%(1),L:screen%(1),-1) !Back to the map
ENDIF
PUT (i&-xbase&)*10,(j&-ybase&)*10,cursor$
x&=map&(i&,j&)
ENDIF
NEXT j&
NEXT i&
SHOWM
RETURN
> PROCEDURE select_map_loc !Chooses any visible map location
IF NOT on_map&
CLS
SPUT map$
on_icon&=FALSE
on_map&=TRUE
ENDIF
DEFMOUSE 7
WHILE MOUSEK>0
WEND
MOUSE mx&,my&,mse&
i&=0
WHILE mse&=0
INC i&
IF i&=100
i&=0
IF j&=1
j&=0
DEFMOUSE 6
ELSE
j&=1
DEFMOUSE 7
ENDIF
ENDIF
MOUSE mx&,my&,mse&
WEND
DEFMOUSE 0
x&=INT(mx&/10)
y&=INT(my&/10)
RETURN
> PROCEDURE save_map !Save Map to disk
CLS
PRINT "Save Map..."
mapfilename$=""
FILESELECT "\*.MAP","",mapfilename$
IF mapfilename$>"" AND RIGHT$(mapfilename$,1)<>"\"
IF INSTR(mapfilename$,".")
mapfilename$=LEFT$(mapfilename$,INSTR(mapfilename$,".")-1)
ENDIF
mapfilename$=mapfilename$+".MAP"
ON ERROR GOSUB save_map_error
OPEN "O",#1,mapfilename$
CLS
PRINT "Saving Map... ";mapfilename$
DEFMOUSE 2
WRITE #1,title$
WRITE #1,subtitle$
WRITE #1,xmax&
WRITE #1,ymax&
FOR i&=0 TO xmax&
FOR j&=0 TO ymax&
WRITE #1,map&(i&,j&)
NEXT j&
PRINT AT(1,2);USING "##.#% Complete.",(i&/xmax&)*100
NEXT i&
CLOSE #1
ON ERROR
DEFMOUSE 0
map_saved&=TRUE
ELSE
ALERT 1," | Map Is NOT Saved... | ",1,"OK",a&
ENDIF
GOSUB recover_screen
RETURN
> PROCEDURE save_map_error !Recover from disk error if possible
ALERT 2," | Error Encountered During Save | "+ERR$(ERR),1," OK ",a&
RESUME map_save_err_return
map_save_err_return:
CLOSE #1
DEFMOUSE 0
ALERT 1," | Map Saved State Is Unknown. | ",1,"OK",a&
GOSUB recover_screen
RETURN
> PROCEDURE save_legend !Save Legend to disk
CLS
PRINT "Save Legend..."
mapfilename$=""
FILESELECT "\*.LEG","",mapfilename$
IF mapfilename$>"" AND RIGHT$(mapfilename$,1)<>"\"
IF INSTR(mapfilename$,".")
mapfilename$=LEFT$(mapfilename$,INSTR(mapfilename$,".")-1)
ENDIF
mapfilename$=mapfilename$+".LEG"
ON ERROR GOSUB save_legend_error
OPEN "O",#1,mapfilename$
CLS
PRINT "Saving Legend... ";mapfilename$
DEFMOUSE 2
WRITE #1,lmax&
WRITE #1,l_current_max&
FOR i&=0 TO lmax&
WRITE #1,legend&(i&)
PRINT AT(1,2);USING "PART 1 of 2: ##.#% Complete.",(i&/lmax&)*100
NEXT i&
FOR i&=0 TO l_current_max&
FOR j&=0 TO 4
WRITE #1,legend$(i&,j&)
NEXT j&
IF l_current_max&>10
PRINT AT(1,2);USING "PART 2 of 2: ##.#% Complete.",(i&/l_current_max&)*100
ELSE
PRINT AT(1,2);"PART 2 of 2: Saving..."
ENDIF
NEXT i&
CLOSE #1
ON ERROR
DEFMOUSE 0
legend_saved&=TRUE
ELSE
ALERT 1," | Legend Is NOT Saved... | ",1,"OK",a&
ENDIF
GOSUB recover_screen
RETURN
> PROCEDURE save_legend_error !Recover from disk error if possible
ALERT 2," | Error Encountered During Save | "+ERR$(ERR),1," OK ",a&
RESUME legend_save_err_return
legend_save_err_return:
CLOSE #1
DEFMOUSE 0
ALERT 1," | Legend Saved State Is Unknown. | ",1,"OK",a&
GOSUB recover_screen
RETURN
> PROCEDURE load_map !Load Map from disk
LOCAL i&,j&
IF NOT map_saved&
ALERT 2," | This Map Isn't Saved. | Load Another Map Anyway? ",2," Yes | No ",a&
ELSE
a&=1
ENDIF
IF a&=1
CLS
PRINT "Load Map..."
mapfilename$=""
FILESELECT "\*.MAP","",mapfilename$
IF mapfilename$>"" AND RIGHT$(mapfilename$,1)<>"\"
IF RIGHT$(mapfilename$,1)="."
mapfilename$=LEFT$(mapfilename$,INSTR(mapfilename$,".")-1)
ENDIF
ON ERROR GOSUB load_map_error
OPEN "I",#1,mapfilename$
CLS
PRINT "Loading Map... ";mapfilename$
DEFMOUSE 2
on_icon&=FALSE
on_map&=FALSE
xbase&=0 !See init for explanation...
ybase&=0
INPUT #1,title$
INPUT #1,subtitle$
CHAR{{OB_SPEC(dialog3%,5)}}=title$
CHAR{{OB_SPEC(dialog3%,8)}}=subtitle$
INPUT #1,xmax&
INPUT #1,ymax&
ERASE map&(),m|()
DIM map&(xmax&,ymax&)
DIM m|(xmax&,ymax&)
ARRAYFILL map&(),-1
FOR i&=0 TO xmax&
FOR j&=0 TO ymax&
INPUT #1,map&(i&,j&)
NEXT j&
PRINT AT(1,2);USING "##.#% Complete.",(i&/xmax&)*100
NEXT i&
CLOSE #1
~XBIOS(5,L:screen%(2),L:screen%(1),-1)
CLS
SPUT icons$
~XBIOS(5,L:screen%(1),L:screen%(1),-1)
CLS
ON ERROR
DEFMOUSE 0
GOSUB redraw_from_array
GOSUB icon_main_loop
map_saved&=TRUE
ELSE
ALERT 1," | Map Is NOT Loaded... | ",1,"OK",a&
IF xmax&>0
GOSUB recover_screen
ENDIF
ENDIF
ENDIF
RETURN
> PROCEDURE load_legend !Load Legend from disk
LOCAL i&,j&
IF (NOT legend_saved&) AND l_current_max&>0
ALERT 2," | This Legend Isn't Saved. | Load Another One Anyway? ",2," Yes | No ",a&
ELSE
a&=1
ENDIF
IF a&=1
CLS
PRINT "Load Legend..."
mapfilename$=""
FILESELECT "\*.LEG","",mapfilename$
IF mapfilename$>"" AND RIGHT$(mapfilename$,1)<>"\"
IF RIGHT$(mapfilename$,1)="."
mapfilename$=LEFT$(mapfilename$,INSTR(mapfilename$,".")-1)
ENDIF
ON ERROR GOSUB load_legend_error
OPEN "I",#1,mapfilename$
CLS
PRINT "Loading Legend... ";mapfilename$
DEFMOUSE 2
ERASE legend$(),l&(),legend&()
INPUT #1,lmax&
DIM legend$(lmax&,4)
DIM legend&(lmax&) !Legend Icons
DIM l&(lmax&) !Internal flag array for legend&()
INPUT #1,l_current_max&
FOR i&=0 TO lmax&
INPUT #1,legend&(i&)
IF lmax&>0 AND MOD(i&,10)=0
PRINT AT(1,2);USING "PART 1 of 2: ##.#% Complete.",(i&/lmax&)*100
ENDIF
NEXT i&
PRINT AT(1,2);" "
FOR i&=0 TO l_current_max&
FOR j&=0 TO 4
INPUT #1,legend$(i&,j&)
NEXT j&
IF l_current_max&>10
PRINT AT(1,2);USING "PART 2 of 2: ##.#% Complete.",(i&/l_current_max&)*100
ELSE
PRINT AT(1,2);"PART 2 of 2: Loading..."
ENDIF
NEXT i&
CLOSE #1
ON ERROR
DEFMOUSE 0
legend_saved&=TRUE
GOSUB redraw_from_array
ELSE
ALERT 1," | Legend Is NOT Loaded... | ",1,"OK",a&
ENDIF
GOSUB recover_screen
ENDIF
RETURN
> PROCEDURE load_map_error !Recover from mem error if possible
ERASE map&(),m|()
ALERT 2," | Error Encountered During Load | ",1,"Show Me",a&
~FORM_ALERT(1,ERR$(ERR))
CLOSE #1
DEFMOUSE 0
ALERT 2," | No Map Loaded.| Program Restarting. | ",1,"Shoot",a&
GOSUB quit
RUN
RETURN
> PROCEDURE load_legend_error !Recover from mem error if possible
ERASE legend$(),legend&(),l&()
ALERT 2," | Error Encountered During Load | ",1,"Show Me",a&
~FORM_ALERT(1,ERR$(ERR))
CLOSE #1
DEFMOUSE 0
ALERT 3," | No Legend Loaded.| ",1,"Enough!",a&
l_current_max&=0
lmax&=0
DIM legend$(lmax&,4) !Legend Text
DIM legend&(lmax&) !Legend Icons
DIM l&(lmax&) !Internal pointer array for legend&()
RESUME x
x:
GOSUB recover_screen
RETURN
> PROCEDURE rotate_map !Turn it clockwise
IF ymax&<>xmax&
ALERT 3," | Can't Rotate A Map | That Isn't Square |",1," OK ",a&
ELSE
ALERT 2," | VERIFY: You Wish To | Rotate This Map? | (Disk Space Needed! SAVE!)",1," Yes | Cancel ",a&
IF a&=1
IF NOT EXIST("iomap.map")
ON ERROR GOSUB iomap_error
OPEN "O",#1,"iomap.map"
DEFMOUSE 2
FOR i&=0 TO xmax&
FOR j&=0 TO ymax&
WRITE #1,map&(i&,j&)
NEXT j&
NEXT i&
CLOSE #1
OPEN "i",#1,"iomap.map"
FOR i&=0 TO xmax&
FOR j&=ymax& TO 0 STEP -1
INPUT #1,map&(j&,i&)
NEXT j&
NEXT i&
CLOSE #1
KILL "iomap.map"
ON ERROR
GOSUB redraw_from_array
DEFMOUSE 0
ELSE
ALERT 1," | I Use The File Name | 'IOMAP.MAP' To Rotate. | Please Rename Your File. |",1," OK ",a&
ENDIF
ENDIF
ENDIF
RETURN
> PROCEDURE flip_map !Switch east-west
IF ymax&<>xmax&
ALERT 3," | Can't Flip A Map | That Isn't Square |",1," OK ",a&
ELSE
ALERT 2," | VERIFY: You Wish To | Flip This Map? | (Disk Space Needed! SAVE!)",1," Yes | Cancel ",a&
IF a&=1
IF NOT EXIST("iomap.map")
ON ERROR GOSUB iomap_error
OPEN "O",#1,"iomap.map"
DEFMOUSE 2
FOR i&=0 TO xmax&
FOR j&=0 TO ymax&
WRITE #1,map&(i&,j&)
NEXT j&
NEXT i&
CLOSE #1
OPEN "i",#1,"iomap.map"
FOR i&=xmax& TO 0 STEP -1
FOR j&=0 TO ymax&
INPUT #1,map&(i&,j&)
NEXT j&
NEXT i&
CLOSE #1
KILL "iomap.map"
ON ERROR
GOSUB redraw_from_array
DEFMOUSE 0
ELSE
ALERT 1," | I Use The File Name | 'IOMAP.MAP' To Flip. | Please Rename Your File. |",1," OK ",a&
ENDIF
ENDIF
ENDIF
RETURN
> PROCEDURE iomap_error !Disk Recovery
ALERT 2," | Disk Error Encountered | "+ERR$(ERR),1," OK ",a&
RESUME err_return
err_return:
CLOSE #1
KILL "iomap.map"
DEFMOUSE 0
ALERT 1," | State Of Map Is Unknown. | Reload Recommended. |",1,"OK",a&
GOSUB recover_screen
RETURN
> PROCEDURE ins_column_row !Insert a column or row
ALERT 2," | Insert What? | ",3," Column | Row | Cancel ",a&
SELECT a&
CASE 1
overwrite&=FALSE
FOR i&=0 TO ymax&
IF map&(xmax&,i&)>=0
overwrite&=TRUE
ENDIF
NEXT i&
IF overwrite&
ALERT 3," | WARNING: You Will | Lose The Eastern- | Most Column ",2," OK | Cancel ",a&
IF a&=1
overwrite&=FALSE
ENDIF
ENDIF
IF overwrite&=FALSE
GOSUB select_map_loc
DEFMOUSE 2
FOR i&=xmax& TO 0 STEP -1
FOR j&=ymax& TO x&+1+xbase& STEP -1
map&(j&,i&)=map&(j&-1,i&)
NEXT j&
map&(j&,i&)=-1
NEXT i&
GOSUB redraw_from_array
map_saved&=FALSE
DEFMOUSE 0
map_saved&=FALSE
ENDIF
CASE 2
overwrite&=FALSE
FOR i&=0 TO xmax&
IF map&(i&,ymax&)>=0
overwrite&=TRUE
ENDIF
NEXT i&
IF overwrite&
ALERT 1," | WARNING: You Will | Lose The Southern- | Most Row ",2," OK | Cancel ",a&
IF a&=1
overwrite&=FALSE
ENDIF
ENDIF
IF overwrite&=FALSE
GOSUB select_map_loc
DEFMOUSE 2
FOR i&=ymax& TO 0 STEP -1
FOR j&=xmax& TO y&+1+ybase& STEP -1
map&(i&,j&)=map&(i&,j&-1)
NEXT j&
map&(i&,j&)=-1
NEXT i&
GOSUB redraw_from_array
DEFMOUSE 0
map_saved&=FALSE
ENDIF
ENDSELECT
RETURN
> PROCEDURE del_column_row !Delete a column or row
ALERT 2," | Delete What? | ",3," Column | Row | Cancel ",a&
SELECT a&
CASE 1
GOSUB select_map_loc
DEFMOUSE 2
FOR i&=0 TO xmax&
FOR j&=x&+xbase& TO ymax&-1
map&(j&,i&)=map&(j&+1,i&)
NEXT j&
map&(ymax&,i&)=-1
NEXT i&
GOSUB redraw_from_array
map_saved&=FALSE
DEFMOUSE 0
CASE 2
GOSUB select_map_loc
DEFMOUSE 2
FOR i&=0 TO ymax&
FOR j&=y&+ybase& TO xmax&-1
map&(i&,j&)=map&(i&,j&+1)
NEXT j&
map&(i&,xmax&)=-1
NEXT i&
GOSUB redraw_from_array
map_saved&=FALSE
DEFMOUSE 0
ENDSELECT
RETURN
> PROCEDURE fill_area !Fill all similiar connecting spaces
ARRAYFILL m|(),0
cursor2$=cursor$
cursor2&=cursor&
ALERT 2," | Select An Icon To Fill | With. | Right Click When Done. | ",1," OK | Cursor | Cancel ",a&
IF a&<3
IF a&=1
MOUSE mx&,my&,mse&
WHILE mse&<>2
MOUSE mx&,my&,mse&
GOSUB icon_main_loop
WEND
ENDIF
GOSUB select_map_loc
DEFMOUSE 2
loc&=map&(x&+xbase&,y&+ybase&)
m|(x&,y&)=2 !0=no,1=yes,2=check
no_more&=FALSE
REPEAT
no_more&=TRUE
FOR i&=0 TO 31
FOR j&=0 TO 19
IF m|(i&,j&)=2
IF map&(i&+xbase&,j&+ybase&)=loc&
map&(i&+xbase&,j&+ybase&)=cursor&
m|(i&,j&)=1
ELSE
m|(i&,j&)=0
ENDIF
no_more&=FALSE
' ** y-1
IF j&>0
IF map&(i&+xbase&,j&+ybase&-1)=loc&
IF m|(i&,j&-1)<>1
m|(i&,j&-1)=2
ENDIF
ENDIF
ENDIF
' ** y+1
IF j&+ybase&<ymax&
IF map&(i&+xbase&,j&+ybase&+1)=loc&
IF m|(i&,j&+1)<>1
m|(i&,j&+1)=2
ENDIF
ENDIF
ENDIF
' ** x-1
IF i&>0
IF map&(i&+xbase&-1,j&+ybase&)=loc&
IF m|(i&-1,j&)<>1
m|(i&-1,j&)=2
ENDIF
ENDIF
' ** x+1
ENDIF
IF i&+xbase&<xmax&
IF map&(i&+xbase&+1,j&+ybase&)=loc&
IF m|(i&+1,j&)<>1
m|(i&+1,j&)=2
ENDIF
ENDIF
ENDIF
ENDIF
NEXT j&
NEXT i&
UNTIL no_more&
map_saved&=FALSE
GOSUB redraw_from_array
DEFMOUSE 0
ENDIF
cursor$=cursor2$
cursor&=cursor2&
DEFMOUSE 0
RETURN
> PROCEDURE print_graph_paper !Utility to print graph paper <EPSON>
' THIS IS TESTED ON AN EPSON LX-86 ONLY.
'
FOR loop&=0 TO 1
~FORM_DIAL(loop&,0,0,0,0,x7%,y7%,w7%,h7%)
NEXT loop&
~OBJC_CHANGE(dialog7%,14,0,x7%,y7%,w7%,h7%,32,0)
~OBJC_DRAW(dialog7%,0,2,x7%,y7%,w7%,h7%)
obj7%=FORM_DO(dialog7%,0)
~OBJC_CHANGE(dialog7%,obj7%,0,x7%,y7%,w7%,h7%,0,0)
IF BTST(OB_STATE(dialog7%,13),0) !Line joins?
joins|=128 !Yes
ELSE
joins|=32 !No
ENDIF
IF obj7%=14
DEFMOUSE 2
size&=VAL(CHAR{{OB_SPEC(dialog7%,7)}}) !Size
IF size&=0 !Zero not allowed
size&=1
ENDIF
LPRINT CHR$(27)+"1"; !No pixels between rows
LPRINT CHR$(27)+"m"+CHR$(4) !Graphics character set
y&=INT(79/(size&+1))
z&=INT(107/(size&+1))
FOR i&=1 TO VAL(CHAR{{OB_SPEC(dialog7%,4)}}) ! Quantity
IF i&>1
LPRINT CHR$(12)
ENDIF
FOR j&=1 TO z&
FOR k&=1 TO y&
LPRINT CHR$(joins|);
FOR l&=1 TO size&
LPRINT CHR$(133);
NEXT l&
NEXT k&
LPRINT CHR$(joins|)
FOR k&=1 TO size&
FOR l&=1 TO y&
LPRINT CHR$(134);
FOR m&=1 TO size&
LPRINT CHR$(32);
NEXT m&
NEXT l&
LPRINT CHR$(134)
NEXT k&
NEXT j&
FOR j&=1 TO y&
LPRINT CHR$(joins|);
FOR k&=1 TO size&
LPRINT CHR$(133);
NEXT k&
NEXT j&
LPRINT CHR$(joins|)
NEXT i&
LPRINT CHR$(12) !Eject Page
DEFMOUSE 0
ENDIF
FOR loop&=2 TO 3
~FORM_DIAL(loop&,0,0,0,0,x7%,y7%,w7%,h7%)
NEXT loop&
GOSUB recover_screen
RETURN
> PROCEDURE quit !Clean up memory and that's all folks!
~RSRC_FREE()
RESERVE FRE(0)+33000
forever&=FALSE
RETURN
> PROCEDURE allocate_screens !Initialize page flip
' *************************************************************************
' THIS CODE ISN'T MINE - JC
' (I wish I knew who to thank for it - it came off some sample code
' that I downloaded somewhere...)
' I'm not really using page flipping in this program. I read the icons
' at logical base while drawing the map at physical base... It's more
' like dual-screen processing...?
' The below comments came with the code, though I've chopped things up to
' take out the actual page flip.
' *************************************************************************
' Save original screen settings:
'
physbase%=XBIOS(2)
logbase%=XBIOS(3)
'
DIM screen$(2),screen%(2)
'
' Set up two screens in memory. More are just as easy. Each needs to be
' on a 512 byte boundry, so dimension a string to 32512 bytes and then
' move to the boundry.
'
screen%(1)=physbase%
screen$(2)=SPACE$(32512)
screen%(2)=(INT(VARPTR(screen$(2))/512)+1)*512
RETURN
> PROCEDURE config_printer !1280 or 960 pixels/print to screen?
r%=XBIOS(33,-1)
IF BTST(r%,2)
~OBJC_CHANGE(dialog6%,6,0,x6%,y6%,w6%,h6%,0,0)
~OBJC_CHANGE(dialog6%,5,0,x6%,y6%,w6%,h6%,1,0)
ELSE
~OBJC_CHANGE(dialog6%,6,0,x6%,y6%,w6%,h6%,1,0)
~OBJC_CHANGE(dialog6%,5,0,x6%,y6%,w6%,h6%,0,0)
ENDIF
IF print_to_screen&
~OBJC_CHANGE(dialog6%,9,0,x6%,y6%,w6%,h6%,1,0)
~OBJC_CHANGE(dialog6%,10,0,x6%,y6%,w6%,h6%,0,0)
ELSE
~OBJC_CHANGE(dialog6%,9,0,x6%,y6%,w6%,h6%,0,0)
~OBJC_CHANGE(dialog6%,10,0,x6%,y6%,w6%,h6%,1,0)
ENDIF
FOR loop&=0 TO 1
~FORM_DIAL(loop&,0,0,0,0,x6%,y6%,w6%,h6%)
NEXT loop&
~OBJC_CHANGE(dialog6%,12,0,x6%,y6%,w6%,h6%,32,0)
~OBJC_DRAW(dialog6%,0,2,x6%,y6%,w6%,h6%)
obj6%=FORM_DO(dialog6%,0)
IF BTST(OB_STATE(dialog6%,6),0)
~XBIOS(33,BCLR(r%,2)) !Atari
ELSE
~XBIOS(33,BSET(r%,2)) !Epson
ENDIF
IF BTST(OB_STATE(dialog6%,10),0)
print_to_screen&=FALSE !Printer
ELSE
print_to_screen&=TRUE !Screen
ENDIF
FOR loop&=2 TO 3
~FORM_DIAL(loop&,0,0,0,0,x6%,y6%,w6%,h6%)
NEXT loop&
RETURN
> PROCEDURE print_tiled !Pages join together to form 1 map
IF print_to_screen&
ALERT 3," PRINT TILED TO SCREEN: | | Confirm Choice.",1," OK | Cancel ",a&
ELSE
ALERT 3," PRINT TILED TO PRINTER: | | Align Paper And | Set Top Of Form.",1," OK | Cancel ",a&
ENDIF
IF a&=1
' A screen is 40X25
' DIM pr&(25,6) !6=lo-x,lo-y,,n,e,s,w
prx&=18
pry&=31
prpnt|=0
prxbase&=0
WHILE prxbase&<xmax& !Decide what (x,y) coordinates
prybase&=0 !each screen should start on...
WHILE prybase&<ymax&
pr&(prpnt|,1)=prxbase&
pr&(prpnt|,2)=prybase&
IF prybase&+pry&>ymax&
prybase&=ymax&
ELSE
prybase&=prybase&+pry&+1
ENDIF
INC prpnt|
WEND
IF prxbase&+prx&>xmax&
prxbase&=xmax&
ELSE
prxbase&=prxbase&+prx&+1
ENDIF
WEND
DEC prpnt|
x&=pr&(0,1) !Determine map count (x,y)
ycnt&=0
i&=0
WHILE pr&(i&,1)=x&
INC i&
INC ycnt&
WEND
xcnt&=prpnt|/ycnt&
IF MOD(prpnt|,ycnt&)>0
INC xcnt&
ENDIF
FOR i&=0 TO prpnt| !Fill touching east
IF pr&(i&+1,2)>pr&(i&,2)
pr&(i&,4)=i&+1
ELSE
pr&(i&,4)=-1
ENDIF
NEXT i&
FOR i&=prpnt| TO 1 STEP -1 !Fill touching west
IF pr&(i&-1,2)<pr&(i&,2)
pr&(i&,6)=i&-1
ELSE
pr&(i&,6)=-1
ENDIF
NEXT i&
FOR i&=0 TO prpnt| !Fill touching south
IF i&+ycnt&<=prpnt|
pr&(i&,5)=i&+ycnt&
ELSE
pr&(i&,5)=-1
ENDIF
NEXT i&
FOR i&=prpnt| TO 1 STEP -1 !Fill touching north
IF i&-ycnt&>=0
pr&(i&,3)=i&-ycnt&
ELSE
pr&(i&,3)=-1
ENDIF
NEXT i&
ARRAYFILL l&(),-1 !Legend internal
' DIM pr&(25,6) !6=lo-x,lo-y,,n,e,s,w
on_page&=0 !Legend pointer
FOR i|=0 TO prpnt|
CLS
IF pr&(i|,3)=-1 AND pr&(i|,6)=-1 !Upper left map tile?
PRINT AT(1,1);title$;
ENDIF
IF pr&(i|,3)=-1 AND pr&(i|,4)=-1 !Upper right map tile?
PRINT AT(41-LEN(subtitle$),1);subtitle$;
ENDIF
IF pr&(i|,3)=-1 !Upper edge of map?
DEFLINE ,1,2,2
LINE 0,8,319,8
ENDIF
IF pr&(i|,2)+pry&>ymax&
y&=ymax&-pr&(i|,2)
ELSE
y&=pry&
ENDIF
is&=0
FOR i&=pr&(i|,2) TO pr&(i|,2)+y&
IF pr&(i|,1)+prx&>xmax&
z&=xmax&-pr&(i|,1)
ELSE
z&=prx&
ENDIF
js&=0
FOR j&=pr&(i|,1) TO pr&(i|,1)+z&
cursory&=INT(map&(i&,j&)/32)*10
cursorx&=MOD(map&(i&,j&),32)*10
cursor2&=map&(i&,j&)
IF l_current_max&>0
FOR k&=0 TO l_current_max&-1 !Should this icon be in the
IF legend&(k&)=cursor2& !legend?
already&=FALSE
FOR a&=0 TO on_page& !Is it already identified?
IF l&(a&)=k&
already&=TRUE
ENDIF
NEXT a&
IF NOT already& !No, add it to legend.
l&(on_page&)=k& !Store POINTER into legend&
INC on_page&
ENDIF
ENDIF
NEXT k&
ENDIF
~XBIOS(5,L:screen%(2),L:screen%(1),-1) !Peek at the icon screen
GET cursorx&,cursory&,cursorx&+9,cursory&+9,cursor2$ !Get an icon
~XBIOS(5,L:screen%(1),L:screen%(1),-1) !Back to the map
IF pr&(i|,3)=-1 !If upper edge of map
PUT is&*10,js&*10+10,cursor2$ !Leave room for the goodies
ELSE
PUT is&*10,js&*10+10,cursor2$ !Otherwise just drop it
ENDIF
INC js&
NEXT j&
INC is&
NEXT i&
GOSUB print_screen
GOSUB page_eject
NEXT i|
lin_width|=8
h_count&=0
IF on_page&>0
CLS
x$=" L E G E N D "
x&=(319/2)-(LEN(x$)*8/2)
DEFTEXT ,0,0,6
TEXT x&,15,x$
LINE 0,7,319,7
LINE 0,17,319,17
lin_count&=3
h_count&=0
left_side&=0
advancel&=0
advancer&=0
FOR i&=0 TO on_page&-1
cursory&=INT(legend&(l&(i&))/32)*10
cursorx&=MOD(legend&(l&(i&)),32)*10
~XBIOS(5,L:screen%(2),L:screen%(1),-1) !Peek at the icon screen
GET cursorx&,cursory&,cursorx&+9,cursory&+9,cursor2$ !Get an icon
~XBIOS(5,L:screen%(1),L:screen%(1),-1) !Back to the map
PUT 1+left_side&,(lin_count&-1)*lin_width|+3,cursor2$
k&=0
FOR j&=0 TO 4
IF legend$(l&(i&),j&)>""
DEFTEXT ,0,0,4
IF k&<2
TEXT 14+left_side&,(lin_count&)*lin_width|,legend$(l&(i&),j&)
INC k&
ELSE
TEXT 2+left_side&,(lin_count&)*lin_width|,legend$(l&(i&),j&)
ENDIF
IF left_side&=0
INC advancel&
ELSE
INC advancer&
ENDIF
INC lin_count&
ENDIF
IF h_count&>0 AND (lin_count&>=23 OR (lin_count&>=22 AND j&=4))
GOSUB bottom_entry
GOSUB print_screen
GOSUB page_eject
CLS
x$=" L E G E N D (Con't)"
x&=(319/2)-(LEN(x$)*8/2)
DEFTEXT ,0,0,6
TEXT x&,15,x$
LINE 0,7,319,7
LINE 0,17,319,17
lin_count&=3
GOSUB top_entry
h_count&=0
left_side&=1
advancel&=0
advancer&=0
ENDIF
IF h_count&=0 AND (lin_count&>=25 OR (lin_count&>=24 AND j&=4))
GOSUB bottom_entry
GOSUB print_screen
CLS
lin_count&=1
GOSUB top_entry
INC h_count&
left_side&=1
advancel&=0
advancer&=0
ENDIF
NEXT j&
INC lin_count&
IF left_side&=0
left_side&=21*8
lin_count&=lin_count&-advancel&-1
ELSE
left_side&=0
IF advancer&<advancel&
lin_count&=lin_count&+advancel&-advancer&
ENDIF
advancel&=0
advancer&=0
ENDIF
NEXT i&
GOSUB print_screen
ENDIF
GOSUB page_eject
GOSUB redraw_from_array
ENDIF
RETURN
> PROCEDURE print_paged !Notebook style with page # references
IF print_to_screen&
ALERT 3," PRINT PAGED TO SCREEN: | | Confirm Choice.",1," OK | Cancel ",a&
ELSE
ALERT 3," PRINT PAGED TO PRINTER: | | Align Paper And | Set Top Of Form.",1," OK | Cancel ",a&
ENDIF
IF a&=1
' A screen is 40X25
' DIM pr&(25,6) !6=lo-x,lo-y,,n,e,s,w
prx&=16
pry&=29
prpnt|=0
prxbase&=0
WHILE prxbase&<xmax& !Decide what (x,y) coordinates
prybase&=0 !each screen should start on...
WHILE prybase&<ymax&
pr&(prpnt|,1)=prxbase&
pr&(prpnt|,2)=prybase&
IF prybase&+pry&>ymax&
prybase&=ymax&
ELSE
prybase&=prybase&+pry&+1
ENDIF
INC prpnt|
WEND
IF prxbase&+prx&>xmax&
prxbase&=xmax&
ELSE
prxbase&=prxbase&+prx&+1
ENDIF
WEND
DEC prpnt|
x&=pr&(0,1) !Determine map count (x,y)
ycnt&=0
i&=0
WHILE pr&(i&,1)=x&
INC i&
INC ycnt&
WEND
xcnt&=prpnt|/ycnt&
IF MOD(prpnt|,ycnt&)>0
INC xcnt&
ENDIF
FOR i&=0 TO prpnt| !Fill touching east
IF pr&(i&+1,2)>pr&(i&,2)
pr&(i&,4)=i&+1
ELSE
pr&(i&,4)=-1
ENDIF
NEXT i&
FOR i&=prpnt| TO 1 STEP -1 !Fill touching west
IF pr&(i&-1,2)<pr&(i&,2)
pr&(i&,6)=i&-1
ELSE
pr&(i&,6)=-1
ENDIF
NEXT i&
FOR i&=0 TO prpnt| !Fill touching south
IF i&+ycnt&<=prpnt|
pr&(i&,5)=i&+ycnt&
ELSE
pr&(i&,5)=-1
ENDIF
NEXT i&
FOR i&=prpnt| TO 1 STEP -1 !Fill touching north
IF i&-ycnt&>=0
pr&(i&,3)=i&-ycnt&
ELSE
pr&(i&,3)=-1
ENDIF
NEXT i&
FOR i|=0 TO prpnt|
on_page&=0 !Legend pointer
ARRAYFILL l&(),-1 !Legend internal
CLS
PRINT AT(1,1);title$;
PRINT AT(41-LEN(subtitle$),1);subtitle$;
x$=" PAGE "+STR$(i|+1)+" "
DEFLINE ,1,2,2
LINE 0,8,319,8
x&=(319/2)-(LEN(x$)*8/2)
DEFTEXT ,0,0,6
TEXT x&,6,x$
IF pr&(i|,6)=-1 !Route West
x$="End Of Map West"
ELSE
x$="West To Page "+STR$(pr&(i|,6)+1)
ENDIF
x&=(LEN(x$)*8/2)+(199/2)
DEFTEXT ,0,900,6
TEXT 6,x&,x$
IF pr&(i|,4)=-1 !Route East
x$="End Of Map East"
ELSE
x$="East To Page "+STR$(pr&(i|,4)+1)
ENDIF
x&=(199/2)-(LEN(x$)*8/2)
DEFTEXT ,0,2700,6
TEXT 313,x&,x$
IF pr&(i|,3)=-1 !Route North
x$="End Of Map North"
ELSE
x$="North To Page "+STR$(pr&(i|,3)+1)
ENDIF
x&=(319/2)-(LEN(x$)*8/2)
DEFTEXT ,0,0,6
TEXT x&,16,x$
IF pr&(i|,5)=-1 !Route South
x$="End Of Map South"
ELSE
x$="South To Page "+STR$(pr&(i|,5)+1)
ENDIF
x&=(319/2)-(LEN(x$)*8/2)
DEFTEXT ,0,0,6
TEXT x&,198,x$
IF pr&(i|,2)+pry&>ymax&
y&=ymax&-pr&(i|,2)
ELSE
y&=pry&
ENDIF
is&=0
FOR i&=pr&(i|,2) TO pr&(i|,2)+y&
IF pr&(i|,1)+prx&>xmax&
z&=xmax&-pr&(i|,1)
ELSE
z&=prx&
ENDIF
js&=0
FOR j&=pr&(i|,1) TO pr&(i|,1)+z&
cursory&=INT(map&(i&,j&)/32)*10
cursorx&=MOD(map&(i&,j&),32)*10
cursor2&=map&(i&,j&)
IF l_current_max&>0
FOR k&=0 TO l_current_max&-1 !Should this icon be in this
IF legend&(k&)=cursor2& !page's legend?
already&=FALSE
FOR a&=0 TO on_page& !Is it already identified?
IF l&(a&)=k&
already&=TRUE
ENDIF
NEXT a&
IF NOT already& !No, add it to legend.
l&(on_page&)=k& !Store POINTER to legend&
INC on_page&
ENDIF
ENDIF
NEXT k&
ENDIF
~XBIOS(5,L:screen%(2),L:screen%(1),-1) !Peek at the icon screen
GET cursorx&,cursory&,cursorx&+9,cursory&+9,cursor2$ !Get an icon
~XBIOS(5,L:screen%(1),L:screen%(1),-1) !Back to the map
PUT is&*10+10,js&*10+20,cursor2$
INC js&
NEXT j&
INC is&
NEXT i&
GOSUB print_screen
CLS
lin_width|=8
h_count&=0
IF on_page&>0
CLS
x$=" L E G E N D "
x&=(319/2)-(LEN(x$)*8/2)
DEFTEXT ,0,0,6
TEXT x&,15,x$
LINE 0,7,319,7
LINE 0,17,319,17
lin_count&=3
page_no&=0
left_side&=0
advancel&=0
advancer&=0
FOR i&=0 TO on_page&-1
cursory&=INT(legend&(l&(i&))/32)*10
cursorx&=MOD(legend&(l&(i&)),32)*10
~XBIOS(5,L:screen%(2),L:screen%(1),-1) !Peek at the icon screen
GET cursorx&,cursory&,cursorx&+9,cursory&+9,cursor2$ !Get an icon
~XBIOS(5,L:screen%(1),L:screen%(1),-1) !Back to the map
PUT 1+left_side&,(lin_count&-1)*lin_width|+3,cursor2$
k&=0
FOR j&=0 TO 4
IF legend$(l&(i&),j&)>""
DEFTEXT ,0,0,4
IF k&<2
TEXT 14+left_side&,(lin_count&)*lin_width|,legend$(l&(i&),j&)
INC k&
ELSE
TEXT 2+left_side&,(lin_count&)*lin_width|,legend$(l&(i&),j&)
ENDIF
IF left_side&=0
INC advancel&
ELSE
INC advancer&
ENDIF
INC lin_count&
ENDIF
IF page_no&=0 AND (lin_count&>=23 OR (lin_count&>=22 AND j&=4))
GOSUB bottom_entry
GOSUB print_screen
GOSUB page_eject
CLS
x$=" L E G E N D (Con't)"
x&=(319/2)-(LEN(x$)*8/2)
DEFTEXT ,0,0,6
TEXT x&,15,x$
LINE 0,7,319,7
LINE 0,17,319,17
lin_count&=3
GOSUB top_entry
INC page_no&
h_count&=0
left_side&=1
advancel&=0
advancer&=0
ENDIF
IF page_no&>0 AND h_count&>0 AND (lin_count&>=22 OR (lin_count&>=21 AND j&=4))
GOSUB bottom_entry
GOSUB print_screen
GOSUB page_eject
CLS
x$=" L E G E N D (Con't)"
x&=(319/2)-(LEN(x$)*8/2)
DEFTEXT ,0,0,6
TEXT x&,15,x$
LINE 0,7,319,7
LINE 0,17,319,17
lin_count&=3
GOSUB top_entry
INC page_no&
h_count&=0
left_side&=1
advancel&=0
advancer&=0
ENDIF
IF page_no&>0 AND h_count&=0 AND (lin_count&>=24 OR (lin_count&>=23 AND j&=4))
GOSUB bottom_entry
GOSUB print_screen
CLS
lin_count&=0
GOSUB top_entry
INC page_no&
INC h_count&
left_side&=1
advancel&=0
advancer&=0
ENDIF
NEXT j&
INC lin_count&
IF left_side&=0
left_side&=21*8
lin_count&=lin_count&-advancel&-1
ELSE
left_side&=0
IF advancer&<advancel&
lin_count&=lin_count&+advancel&-advancer&
ENDIF
advancel&=0
advancer&=0
ENDIF
NEXT i&
GOSUB print_screen
ENDIF
GOSUB page_eject
NEXT i|
GOSUB redraw_from_array
ENDIF
RETURN
> PROCEDURE bottom_entry !Handle printing end of page legend
kbe&=0
IF i&<=on_page&-2
bottom_page&=TRUE
left_side&=21*8
cursory&=INT(legend&(l&(i&+1))/32)*10
cursorx&=MOD(legend&(l&(i&+1)),32)*10
~XBIOS(5,L:screen%(2),L:screen%(1),-1) !Peek at the icon screen
GET cursorx&,cursory&,cursorx&+9,cursory&+9,cursor2$ !Get an icon
~XBIOS(5,L:screen%(1),L:screen%(1),-1) !Back to the map
PUT 1+left_side&,(lin_count&-advancel&-1)*lin_width|+3,cursor2$
FOR ibe&=0 TO 4
IF kbe&<advancel&
IF legend$(l&(i&+1),ibe&)>""
DEFTEXT ,0,0,4
IF kbe&<2
TEXT 14+left_side&,(lin_count&-advancel&+kbe&)*lin_width|,legend$(l&(i&+1),ibe&)
INC kbe&
ELSE
TEXT 2+left_side&,(lin_count&-advancel&+kbe&)*lin_width|,legend$(l&(i&+1),ibe&)
INC kbe&
ENDIF
ENDIF
ENDIF
NEXT ibe&
ENDIF
RETURN
> PROCEDURE top_entry !Does the top of the next page
IF kbe&>0 AND kbe&<5
FOR ite&=kbe& TO 4
IF legend$(l&(i&),ite&)>""
DEFTEXT ,0,0,4
IF ite&<2
TEXT 14,(lin_count&)*lin_width|,legend$(l&(i&),ite&)
INC lin_count&
INC advancel&
ELSE
TEXT 2,(lin_count&)*lin_width|,legend$(l&(i&),ite&)
INC lin_count&
INC advancel&
ENDIF
ELSE
IF legend$(l&(i&+1),ite&)>""
INC lin_count&
INC advancel&
ENDIF
ENDIF
IF legend$(l&(i&+1),ite&)>""
DEFTEXT ,0,0,4
IF kbe&<2
TEXT 14+left_side&,(lin_count&-advancel&+kbe&)*lin_width|,legend$(l&(i&+1),ite&)
INC kbe&
ELSE
TEXT 2+left_side&,(lin_count&-advancel&+kbe&)*lin_width|,legend$(l&(i&+1),ite&)
INC kbe&
ENDIF
ENDIF
NEXT ite&
ENDIF
INC i&
j&=4
RETURN
> PROCEDURE print_screen !Output to choosen destination
IF print_to_screen&
ALERT 1," | Screen Print Here. | Press Return Twice | To Continue |",1,"OK|Printer",a&
IF a&=1
WHILE INKEY$=""
WEND
ELSE
HIDEM
HARDCOPY
SHOWM
ENDIF
ELSE
HIDEM
HARDCOPY
SHOWM
ENDIF
RETURN
> PROCEDURE page_eject !Pop one off
IF print_to_screen&
ALERT 1," | Page Eject Here. | ",1,"OK|Printer",a&
IF a&=2
LPRINT CHR$(12);
ENDIF
ELSE
LPRINT CHR$(12);
ENDIF
RETURN
> PROCEDURE blank_cursor !So I can recognize a blank cursor
blank$=""
RESTORE blank_cursor_data
FOR i&=1 TO 86
READ a&
blank$=blank$+CHR$(a&)
NEXT i&
blank_cursor_data:
DATA 0,9,0,9,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,53,0,48
RETURN
> PROCEDURE edit_icons !Go fix an icon
WHILE MOUSEK>0
WEND
cursor2$=cursor$
cursor2&=cursor&
ALERT 2," | Select The Icon To Edit. | Right Click When Done. ",1," OK | Cancel ",a&
IF a&=1
IF NOT on_icon&
CLS
SPUT icons$
ENDIF
MOUSE mx&,my&,mse&
k&=FALSE
WHILE mse&<>2
MOUSE mx&,my&,mse&
IF mse&=1
k&=TRUE
x&=INT(mx&/10)*10 !This is the cursor% decode logic
y&=INT(my&/10)*10
GET x&,y&,x&+9,y&+9,cursor$ !Pick up the cursor$
PUT x&,y&,cursor$,10 !Invert it and put it back down.
FOR i&=1 TO 1000 !Pause a sec...
NEXT i&
PUT x&,y&,cursor$ !...And put it back down right.
cursor&=(x&/10)+(y&/10)*32 !Important variable!
cursorx&=x&
cursory&=y&
ENDIF
WEND
IF k&=TRUE
CLS
PRINT AT(12,2);"Edit Icon ... "
PRINT AT(11,4);"Right Click When Done."
PUT 21*10,8,cursor$
FOR i&=0 TO 50 STEP 5
LINE 135,i&+75,185,i&+75
LINE i&+135,75,i&+135,125
NEXT i&
FOR i&=0 TO 10
FOR j&=0 TO 10
a&=POINT(i&+21*10,j&+8)
IF a&=1
FOR k&=0 TO 5
LINE (i&*5+135),(j&*5+75+k&),(i&*5+140),(j&*5+75+k&)
NEXT k&
ENDIF
NEXT j&
NEXT i&
MOUSE mx&,my&,mse&
WHILE mse&<>2
MOUSE mx&,my&,mse&
IF mse&=1 AND mx&>=135 AND mx&<=185 AND my&>=75 AND my&<=125
WHILE MOUSEK=1
WEND
a&=POINT(mx&,my&)
mx&=INT(mx&/5)*5
my&=INT(my&/5)*5
IF a&=0
COLOR 1
ELSE
COLOR 0
ENDIF
FOR k&=1 TO 4
LINE mx&+1,my&+k&,mx&+4,my&+k&
NEXT k&
PLOT (mx&/5)-27+(21*10),(my&/5)-15+8
COLOR 1
ENDIF
WEND
ALERT 2," | Save The Results? | ",1," DISK |Screen|Neither",a&
IF a&=1 OR a&=2
GET 21*10,8,21*10+9,8+9,cursor$
~XBIOS(5,L:screen%(2),L:screen%(1),-1) !Peek at the icon screen
CLS
SPUT icons$
PUT cursorx&,cursory&,cursor$ !Put the icon down
SGET icons$
~XBIOS(5,L:screen%(1),L:screen%(1),-1) !Back to the map
IF cursor&=cursor2&
cursor2$=cursor$
ENDIF
IF a&=1
BSAVE "\DMICONS.DAT",VARPTR(icons$),32000
ENDIF
ENDIF
ELSE
ALERT 1," | No Icon Selected | ",1," OK ",a&
ENDIF
cursor$=cursor2$
cursor&=cursor2&
GOSUB redraw_from_array
SGET map$
GOSUB recover_screen
ENDIF
RETURN